package com.example.tch.case03_16110100521;

/*import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;*/
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class WeloomeActivity extends AppCompatActivity {
    private TextView tv1,tv2;
    private Button btn;
    private SharedPreferences sp;
    private SharedPreferences.Editor editor;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_weloome);
        btn = findViewById(R.id.btn_setting);
        tv1 = findViewById(R.id.tv_uname);
        tv2 = findViewById(R.id.tv_pword);
        tv1.setText(getIntent().getStringExtra("username"));
        tv2.setText(getIntent().getStringExtra("password"));
        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                sp = getSharedPreferences("setting",MODE_PRIVATE);
                editor = sp.edit();
                editor.putString("username",getIntent().getStringExtra("username"));
                editor.commit();
                Intent intent = new Intent(WeloomeActivity.this,SettingActivity.class);
                startActivity(intent);
            }
        };

        btn.setOnClickListener(listener);
    }
}
